import Vue from "vue"
import router from "../router/index"
import store from "../store"

export default {
    mustLogin(){
        let token = localStorage.getItem("token")
        if(!token){
            Vue.prototype.$toast("请先登录!")
            // console.log(store);
            // 调用muations中的chanIsGoBack方法，传一个参数true
            store["_mutations"]["isGoBack/chanBack"][0](true)
            setTimeout(() => {
                router.push("/user")
            }, 1000);
            return false
        }
        return true
    }
}